<!DOCTYPE html>
<html lang="en" class="ace ace-card-on ace-tab-nav-on ace-main-nav-on ace-sidebar-on" data-theme-color="#c0e3e7">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Search Result</title>
    <meta name="description" content="">


{#    <link rel="apple-touch-icon" href="apple-touch-icon.png">#}
{#    <link rel="shortcut icon" href="favicon.ico">#}

    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Quicksand:400,700" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">

    <!-- Icon Fonts -->
    <link href="../../static/main_style/fonts/icomoon/style.css" rel="stylesheet">

    <!-- Styles -->
    <link href="../../static/main_style/js/plugins/highlight/solarized-light.css" rel="stylesheet">
    <link href="../../static/main_style/style.css" rel="stylesheet">

    <!-- Modernizer -->
    <script type="text/javascript" src="../../static/main_style/js/vendor/modernizr-3.3.1.min.js"></script>

    <link rel="stylesheet" href="../../static/my_style/css/xadmin.css">
    <script src="../../static/login_style/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript">

        function clickSearchButton(id) {
            var searchForm = document.getElementById(id);
            var kw = searchForm.children[0].children[1].value;
            {#window.alert(kw);#}
            if (kw === "") {
                window.alert("Nothing to Search")
            }
            else {
                var data = {};
                data["kw"] = kw;
                $.ajax({
                        type: 'POST',
                        url: '/scholar/easySearch',
                        dataType: 'json',
                        contentType: 'application/json; charset=utf-8',
                        data: JSON.stringify(data),
                        success: window.onload=function(callback) {
                             if (callback.redirect) {
                                window.location.href = callback.redirect;
                             }
                             else {
                                 window.alert("Something get error!");
                             }
                        },
                        error: function() {
                            window.alert("Something get error!")
                        }
                    });
            }
        }

        function changeRecomm() {
            var recomm = document.getElementsByClassName("widget widget_posts_entries")[0];
            {#window.alert(recomm);#}
            var ul_list = recomm.children[1];
            t_name_list = [];
            for (i = 0; i < ul_list.children.length; ++i) {
                var li_name = ul_list.children[i].children[1].children[0].children[0].innerHTML;
                t_name_list.push(li_name)
            }
            var res;
            $.ajax({
                        type: 'POST',
                        url: '/scholar/recomm',
                        dataType: 'json',
                        contentType: 'application/json; charset=utf-8',
                        async:false,
                        data: JSON.stringify(t_name_list),
                        success: window.onload=function(callback) {
                             res = callback.recomm_list;
                        },
                        error: function() {
                            window.alert("Something get error!");
                        }
                    });
            if (!res) {
                window.alert("Something get error!");
            }
            var i = 0;
            for (i = 0; i < res.length; ++i) {
                var li = ul_list.children[i];
                var a1 = li.children[0];
                var div1 = li.children[1];
                var div2 = li.children[2];
                var img = a1.children[0];
                var a2 = div1.children[0].children[0];
                var a3 = div2.children[0];
                var a4 = div2.children[1];
                img.setAttribute("src", res[i][1]);
                a1.setAttribute("href", "../professor/" + res[i][0]);
                a2.setAttribute("href", "../professor/" + res[i][0]);
                a2.innerHTML = res[i][0];
                a3.innerHTML = (res[i][2]) ? res[i][2] : "None";
                a4.innerHTML = (res[i][3]) ? res[i][3] : "None";
            }
            {#window.alert(i + " " + ul_list.children.length);#}
            for (; i < ul_list.children.length; ++i) {
                {#window.alert(i + " " + ul_list[i]);#}
                ul_list.children[i].remove();
            }
        }
    </script>

    <style>
        .now {
            background-color: #00F7DE;
        }
        a {
            text-decoration: none;
        }
		.ref-box-index {
            position: relative;
            padding-left: 70px;
            padding-bottom: 1.875em;
            margin-bottom: 1.5em;
            min-height: 58px;
            box-sizing: content-box;
        }
    </style>
  </head>
  <body>
     <div class="ace-wrapper">
         <header id="ace-header" class="ace-container-shift ace-logo-in ace-head-boxed ace-nav-right">
             <div class="ace-head-inner">
                 <div class="ace-head-container ace-container">
                     <div class="ace-head-row">
                         <div id="ace-head-col1" class="ace-head-col text-left">
                             <a id="ace-logo" class="ace-logo" href={{ "../index" }}>
                                <img src="../../static/main_style/img/uploads/brand/logo.svg" alt="ace resume"><span>YanHu</span>
                             </a>
                         </div>

                         <div id="ace-head-col2" class="ace-head-col text-right">
                             <div class="ace-nav-container ace-container hidden-sm hidden-xs">
                                 <nav id="ace-main-nav">
                                    <ul class="clear-list">
										<li><a href={{ "../index" }}>hot</a></li>
										<li><a href={{ "../search" }}>search</a></li>
										<li><a href={{ "../favor" }}>favor</a></li>
										<li><a href={{ "../logout" }}>logout</a></li>
									</ul>
                                 </nav>
                             </div>
                         </div>

                         <div id="ace-head-col3" class="ace-head-col text-right">
                             <button id="ace-sidebar-btn" class="btn btn-icon btn-light btn-shade">
                                 <span class="ace-icon ace-icon-side-bar-icon"></span>
                             </button>
                         </div>
                     </div>
                 </div><!-- .ace-container -->
             </div><!-- .ace-head-inner -->
        </header><!-- #ace-header -->


{#        <nav id="ace-nav-sm" class="ace-nav hidden-lg hidden-md">#}
{#            <ul class="clear-list">#}
{#				<li>#}
{#					<a href="index.html" data-tooltip="Home"><img class="avatar avatar-42" src="../../static/my_style/imgs/ha_glass.jpg" alt=""></a>#}
{#				</li>#}
{#				<li>#}
{#					<a href="experience.html" data-tooltip="Experience"><span class="ace-icon ace-icon-experience"></span></a>#}
{#				</li>#}
{#				<li>#}
{#					<a href="portfolio.html" data-tooltip="Portfolio"><span class="ace-icon ace-icon-portfolio"></span></a>#}
{#				</li>#}
{#				<li>#}
{#					<a href="testimonials.html" data-tooltip="References"><span class="ace-icon ace-icon-references"></span></a>#}
{#				</li>#}
{#				<li>#}
{#					<a href="contact.html" data-tooltip="Contact"><span class="ace-icon ace-icon-contact"></span></a>#}
{#				</li>#}
{#				<li>#}
{#					<a href="category.html" data-tooltip="Blog"><span class="ace-icon ace-icon-blog"></span></a>#}
{#				</li>#}
{#			</ul>#}
{#        </nav><!-- #ace-tab-nav-sm -->#}


        <div id="ace-content" class="ace-container-shift">
            <div class="ace-container">


                <div id="ace-nav-wrap" class="hidden-sm hidden-xs">
                        <div class="ace-nav-cont">
                            <div id="ace-nav-scroll">
                                <nav id="ace-nav" class="ace-nav">
                                    <ul class="clear-list">
										<li>
											<a href="#" data-tooltip="Home"><img class="avatar avatar-42" src="../../static/my_style/imgs/ha_glass.jpg" alt=""></a>
										</li>
										<li>
											<a href="#" data-tooltip="Experience"><span class="ace-icon ace-icon-experience"></span></a>
										</li>
										<li>
											<a href="#" data-tooltip="Portfolio"><span class="ace-icon ace-icon-portfolio"></span></a>
										</li>
										<li>
											<a href="#" data-tooltip="References"><span class="ace-icon ace-icon-references"></span></a>
										</li>
										<li>
											<a href="#" data-tooltip="Contact"><span class="ace-icon ace-icon-contact"></span></a>
										</li>
										<li>
											<a href="#" data-tooltip="Blog"><span class="ace-icon ace-icon-blog"></span></a>
										</li>
									</ul>
                                </nav>
                            </div>

                            <div id="ace-nav-tools" class="hidden">
                                <span class="ace-icon ace-icon-dots-three-horizontal"></span>

                                <button id="ace-nav-arrow" class="clear-btn">
                                    <span class="ace-icon ace-icon-chevron-thin-down"></span>
                                </button>
                            </div>
                        </div>
                        <div class="ace-nav-btm"></div>
                    </div><!-- .ace-nav-wrap -->

                <div class="ace-paper-stock">
                    <main class="ace-paper clearfix">
                        <div class="ace-paper-cont clear-mrg">

						<!-- START: PAGE CONTENT -->

                            <div class="padd-box">

                                <header class="search-after">
                                    <h1 class="search-title">search results for:
                                    <span>{{kw}}</span></h1>
                                </header>

                                <div class="search-result">
                                    <strong class="title-lg text-upper">Search Result</strong>
                                </div>

                                <section class="section clear-mrg">

                                    <div class="padd-box-sm clear-mrg">

                                        {% for item in search_items %}
                                            {% set source = item["_source"] %}
                                            <div class="ref-box-index brd-btm hreview">
                                                <div class="ref-avatar">
                                                    <img alt="" src={{ source["avatar"] }} ; class="avatar avatar-54 photo" height="54" width="54">
                                                </div>

                                                <div class="ref-info" style="float: left;">
                                                    <div class="ref-author">
                                                        <a href="{{ "../professor/"  + source["name"] | replace (" ", "%20")}}"><strong>{{ source["name"] }}</strong></a>

                                                        <span>{{ source["school"] }}</span>
                                                         <p>{{ source["title"] }}</p>
                                                    </div>
{#                                                    <blockquote class="ref-cont clear-mrg">#}
{#                                                        <p>{{ source["title"] }}</p>#}
{#                                                    </blockquote>#}
                                                </div>
{#												<blockquote style="border-style:none;">#}
{#													<img src="../../static/main_style/img/favor-1.png"; id={{ source["name"] | replace (" ", "%20") }} ; style="padding-left: 10px; width:12%; height:12%; padding-bottom: 10px; float: right;" alt="notFavor" onclick="clickFavor(this.id)"/>#}
{#												</blockquote>#}
                                            </div><!-- .ref-box -->
                                        {% endfor %}
{#                                            <div class="ref-box brd-btm hreview">#}
{#                                                <div class="ref-avatar">#}
{#                                                    <img alt="" src="../../static/main_style/img/uploads/avatar/avatar-54x54-02.png" class="avatar avatar-54 photo" height="54" width="54">#}
{#                                                </div>#}
{##}
{#                                                <div class="ref-info">#}
{#                                                    <div class="ref-author">#}
{#                                                        <strong>franklin may</strong>#}
{#                                                        <span>Modern LLC,HR</span>#}
{#                                                    </div>#}
{##}
{#                                                    <blockquote class="ref-cont clear-mrg">#}
{#                                                        <p>Your brand is the core of your marketing, the central#}
{#                                                            theme around your products and services.Your brand is not your Logo or your Company Name#}
{#                                                        </p>#}
{#                                                    </blockquote>#}
{#                                                </div>#}
{#                                            </div><!-- .ref-box -->#}
{##}
{#                                            <div class="ref-box brd-btm hreview">#}
{#                                                <div class="ref-avatar">#}
{#                                                    <img alt="" src="../../static/main_style/img/uploads/avatar/avatar-58x58-default.png" class="avatar avatar-54 photo" height="54" width="54">#}
{#                                                </div>#}
{##}
{#                                                <div class="ref-info">#}
{#                                                    <div class="ref-author">#}
{#                                                        <strong>edwin ballard</strong>#}
{#                                                        <span>West Alexandrine</span>#}
{#                                                    </div>#}
{##}
{#                                                    <blockquote class="ref-cont clear-mrg">#}
{#                                                        <p>Your brand is the core of your marketing, the central#}
{#                                                            theme around your products and services.Your brand is not your Logo or your Company Name#}
{#                                                        </p>#}
{#                                                    </blockquote>#}
{#                                                </div>#}
{#                                            </div><!-- .ref-box -->#}


                                    </div><!-- .padd-box-sm -->
                                </section><!-- .section -->



                                <div class="page">
                                    {% if page > 1 %}
                                    <a class="prev" href="{{ url_for("scholar.entities", keyword=kw, page=page - 1) }}">上一页</a>
                                    {% else %}
                                    <a class="prev" href="#">上一页</a>
                                    {% endif %}

                                        {% for cnt in range(1, page_num + 1) %}
                                            {% if cnt != page %}
                                                <a class="current" href="{{ url_for("scholar.entities", keyword=kw, page=cnt) }}">{{ cnt }}</a>
                                            {%else%}
                                                <a class="now" href="#">{{ cnt }}</a>
                                            {% endif %}

                                        {% endfor %}

                                    {% if page < page_num %}
                                    <a class="next" href="{{url_for("scholar.entities", keyword=kw, page=page + 1)}}">下一页</a>
                                    {%else%}
                                    <a class="next" href="#">下一页</a>
                                    {%endif%}
                                    <a href="{{url_for("scholar.entities", keyword=kw, page=page_num)}}">尾页</a>
                              </div>
                            </div>

                        <!-- END: PAGE CONTENT -->

                        </div><!-- .ace-paper-cont -->
                    </main><!-- .ace-paper -->
                </div><!-- .ace-paper-stock -->

            </div><!-- .ace-container -->
        </div><!-- #ace-content -->

    <div id="ace-sidebar">
        <button id="ace-sidebar-close" class="btn btn-icon btn-light btn-shade">
            <span class="ace-icon ace-icon-close"></span>
        </button>

        <div id="ace-sidebar-inner">

            <aside class="widget-area">
                <section class="widget widget_search">
                    <form role="search" method="post" class="search-form" id="easySearch" onSubmit=clickSearchButton(this.id)>
                        <label>
                            <span class="screen-reader-text">Search for:</span>
                            <input type="search" class="search-field" placeholder="Search" value="" name="s">
                        </label>
                        <button type="submit" class="search-submit">
                            <span class="screen-reader-text">Search</span>
                            <span class="ace-icon ace-icon-search"></span>
                        </button>
                    </form>
                </section>

                <section class="widget widget_posts_entries">
                    <h2 class="widget-title">recommendation</h2>
                    <ul>
{#                        {% set st = 0%}#}
{#                        {% set ed = 2 %}#}
                        {% for item in recomm_list %}
                            {% set recomm_url = "../professor/" + item[0] | replace (" ", "%20")  %}
                        <li>
                            <a class="post-image" href={{ recomm_url }}>
                                <img src={{ item[1] }} alt="">
                            </a>
                            <div class="post-content">
                                <h3>
                                    <a href={{ recomm_url }}>{{ item[0] }}</a>
                                </h3>
                            </div>
                            <div class="post-category-comment">
                                <a href="#" class="post-category">{{ item[2] }}</a>
                                <a href="#" class="post-comments">{{ item[3] }}</a>
                            </div>
                        </li>
                        {% endfor %}
                    </ul>
                </section>

                <div class="tagcloud" style="text-align: center">
                    <button style="font-size: 1em; width: 70px; height: 40px; border: none; border-radius: 5%" onclick=changeRecomm()>Next</button>
                </div>

                <br>
                <br>

            </aside>

        </div><!-- #ace-sidebar-inner -->
        </div><!-- #ace-sidebar -->

    <footer id="ace-footer" class="ace-container-shift">
        <div class="ace-container">
			<div class="ace-footer-cont clear-mrg">
				<p class="text-center">@ EE447 Mobile Network Final Project @</p>
			</div>
        </div><!-- .ace-container -->
    </footer><!-- #ace-footer -->

    <!-- Triangle Shapes -->
    <svg id="ace-bg-shape-1" class="hidden-sm hidden-xs" height="519" width="758">
        <polygon points="0,455,693,352,173,0,92,0,0,71" style="fill:#d2d2d2;stroke:purple;stroke-width:0; opacity: 0.5"></polygon>
    </svg>

    <svg id="ace-bg-shape-2" class="hidden-sm hidden-xs" height="536" width="633">
        <polygon points="0,0,633,0,633,536" style="fill:#c0e3e7;stroke:purple;stroke-width:0"></polygon>
    </svg>
</div><!-- .ace-wrapper -->

<!-- Scripts -->
<script type="text/javascript" src="../../static/main_style/js/vendor/jquery-1.12.4.min.js"></script>


<!---<script type="text/javascript" src="http://ditu.google.cn/maps/api/js?key=AIzaSyDiwY_5J2Bkv2UgSeJa4NOKl6WUezSS9XA"></script>--->
<script type="text/javascript" src="../../static/main_style/js/plugins/highlight/highlight.pack.js"></script>
<script type="text/javascript" src="../../static/main_style/js/plugins/jquery.mCustomScrollbar.min.js"></script>
<script type="text/javascript" src="../../static/main_style/js/plugins/isotope.pkgd.min.js"></script>
<script type="text/javascript" src="../../static/main_style/js/plugins/progressbar.min.js"></script>
<script type="text/javascript" src="../../static/main_style/js/plugins/slick.min.js"></script>

<script type="text/javascript" src="../../static/main_style/js/options.js"></script>
<script type="text/javascript" src="../../static/main_style/js/main.js"></script>
</body>
</html>

